﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BookExchange.DAO;
using BookExchange.ODataService;

namespace BookExchange.Business
{
    public abstract class AbsractBusiness<T>
    {
        protected BookExchaneContext DB
        {
            get
            {
                BaseDao.database.UsePostTunneling = true;

                return BaseDao.database;
            }
            set
            {
                BaseDao.database = value;
            }
        }

        public abstract void Insert(T obj);
        public virtual void Update(T obj)
        {
            this.DB.UpdateObject(obj);
            this.DB.SaveChanges();

        }
        public virtual void Delete(T obj)
        {
            this.DB.DeleteObject(obj);
            this.DB.SaveChanges();
        }


    }

    public class mmm : AbsractBusiness<Member>
    {


        public override void Insert(Member obj)
        {
            this.DB.AddToMembers(obj);
            this.DB.SaveChanges();
        }

    }
}